﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Universidad.Negocio.DomainModel;
using System.ComponentModel.DataAnnotations;

namespace UniversidadWeb.Models
{
    public class AlumnoVM
    {
        public AlumnoVM(Alumno alumno)
        {
            this.Id = alumno.Id;
            this.Nombre = alumno.Nombre;
            this.Email = alumno.Email;
            this.Promedio = alumno.CalcularPromedioConAplazos();
            this.MateriasInscriptas = string.Join(",", alumno.Inscripciones
                                                        .Select(im => im.Materia.Nombre)
                                                        .Distinct()
                                                        .ToArray());
        }

        public int Id { get; set; }
        public string Nombre { get; set; }
        public string Email { get; set; }
        public float Promedio { get; set; }
        [Display(Name = "Materias")]
        public string MateriasInscriptas { get; private set; }

    }
}